function Permutation(str)
{
    // write code here
    if(str.length === 0) return []
    let len = str.length
    let res = [] // 储存结果
    let strArr = str.split('')
    function fix(x){
        if(x === len - 1){
            res.push(strArr.join(''))
            return
        }
        let seen = new Set()
        for(let i = x;i < len;i++){
            if(seen.has(strArr[i])){
                continue
            }
            seen.add(strArr[i])
            let temp = strArr[x]
            strArr[x] = strArr[i]
            strArr[i] = temp
            fix(x+1)
            temp = strArr[x]
            strArr[x] = strArr[i]
            strArr[i] = temp
        }

    }
    fix(0)
    return res
}
module.exports = {
    Permutation : Permutation
};